<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>
    Problem in using Dropbox API&#39;s inside Pythonanywhere server : Forums : PythonAnywhere
</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="Forums : PythonAnywhere">
        <meta name="author" content="PythonAnywhere LLP">
        <meta name="google-site-verification" content="O4UxDrfcHjC44jybs2vajc1GgRkTKCTRgVzeV6I9V14" />

        <!-- Le styles -->
        <link href="/static/bootstrap/css/bootstrap.css" rel="stylesheet">
        <link href="/static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
        <link href="/static/anywhere/styles/bootstrap_base.css" rel="stylesheet">
        
    
    <link rel="stylesheet" href="/static/anywhere/styles/forums.css" type="text/css" media="screen" charset="utf-8" />

    <link rel="stylesheet" href="/static/pygments/style.css" type="text/css" media="screen" charset="utf-8" />

        <link rel="stylesheet" href="/static/jquery/jquery-ui-1.8.11.custom.css" type="text/css" media="screen" charset="utf-8" />
        
    
    <link rel="alternate" type="application/rss+xml" title="RSS" href="/forums/topic/761/rss" />

        <style type="text/css">
            body {
                height: auto;
            }
        </style>
        <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
        <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->

        <!-- Le fav and touch icons -->
        <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
        <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
        <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
    </head>

     <body>
        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div id="id_internal_nav_bar_container" class="container">
                    <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    </a>
                    <a class="brand" href="/"><img id="id_logo" src="/static/anywhere/images/logo-234x35.png" height="35" title="PythonAnywhere logo" alt="PythonAnywhere logo" /></a>
                    <div class="nav-collapse">
                        <ul id="id_header_links" class="nav">
                            <li><a id="id_feedback_link" class='feedback_link' href="">Send feedback</a></li>
                            <li><a id="id_forums_link" href="/forums/">Forums</a></li>
                            <li><a href="/wiki/" id="id_help_link">Help</a></li>
                            <li><a href="http://blog.pythonanywhere.com/" id="id_blog_link">Blog</a></li>
                            
                            
                                <li><a style="font-weight: bold;" href="/pricing/" id="id_pricing_link">Pricing & signup</a></li>
                                <li><a href="/login/?next=/forums/topic/761/" id="id_login_link">Log in</a></li>
                            
                        </ul>
                    </div>
                </div>
            </div>
        </div>

        <div class="top-container" id="id_dummy"></div>

        

        
    
    <div class="container">
        <div class="row">
            <div class="span8 offset3">
                <h1>PythonAnywhere Forums</h1>
            </div>
        </div>



    <div class="row">
        <div class="span8 offset3">
            <p>
                <a href="/forums/start_topic/" id="id_start_new_topic">Start a new topic</a> |
                <a href="/forums/">Back to all topics</a> |
                <a href="/forums/topic/761/rss">This topic's RSS</a>
            </p>
        </div>
    </div>
    <div class="row">
        <div class="span8 offset3 topic">
            <h2>Problem in using Dropbox API&#39;s inside Pythonanywhere server</h2>
        </div>
    </div>

    
        <div class="row">
            <div id="id_post_5436" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5436_content_text" class="span8">
                        <p>Hi,
I have developed a Web app, there is a communication between Dropbox and the App through Dropbox API's.</p>
<p>FYI,
My url = http://sansoftaus.pythonanywhere.com
url where I get the error = http://sansoftaus.pythonanywhere.com/Submitted_Code</p>
<p>On my local PC setup I find no problems, but on Pythonanywhere, I get the following error:-</p>
<p>Environment:</p>
<p>Request Method: GET
Request URL: http://sansoftaus.pythonanywhere.com/Submitted_Code/</p>
<p>Django Version: 1.3.7
Python Version: 2.7.4
Installed Applications:</p>
<div class="codehilite"><pre><span class="p">[</span><span class="s">&#39;django.contrib.auth&#39;</span><span class="p">,</span>
 <span class="s">&#39;django.contrib.contenttypes&#39;</span><span class="p">,</span>
 <span class="s">&#39;django.contrib.sessions&#39;</span><span class="p">,</span>
 <span class="s">&#39;django.contrib.sites&#39;</span><span class="p">,</span>
 <span class="s">&#39;django.contrib.messages&#39;</span><span class="p">,</span>
 <span class="s">&#39;django.contrib.staticfiles&#39;</span><span class="p">]</span>
</pre></div>


<p>Installed Middleware:</p>
<div class="codehilite"><pre><span class="p">(</span><span class="s">&#39;django.middleware.common.CommonMiddleware&#39;</span><span class="p">,</span>
 <span class="s">&#39;django.contrib.sessions.middleware.SessionMiddleware&#39;</span><span class="p">,</span>
 <span class="s">&#39;django.middleware.csrf.CsrfViewMiddleware&#39;</span><span class="p">,</span>
 <span class="s">&#39;django.contrib.auth.middleware.AuthenticationMiddleware&#39;</span><span class="p">,</span>
 <span class="s">&#39;django.contrib.messages.middleware.MessageMiddleware&#39;</span><span class="p">)</span>
</pre></div>


<p>Traceback:</p>
<div class="codehilite"><pre><span class="n">File</span> <span class="s">&quot;/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py&quot;</span> <span class="ow">in</span> <span class="n">get_response</span>
  <span class="mf">111.</span>                         <span class="n">response</span> <span class="o">=</span> <span class="n">callback</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="o">*</span><span class="n">callback_args</span><span class="p">,</span> <span class="o">**</span><span class="n">callback_kwargs</span><span class="p">)</span>
<span class="n">File</span> <span class="s">&quot;/home/sansoftaus/Remote_Software/Development/views.py&quot;</span> <span class="ow">in</span> <span class="n">Submitted_code</span>
  <span class="mf">38.</span>     <span class="n">dropbox_request_token</span> <span class="o">=</span> <span class="n">dropbox_sess</span><span class="o">.</span><span class="n">obtain_request_token</span><span class="p">()</span>
<span class="n">File</span> <span class="s">&quot;/usr/local/lib/python2.7/dist-packages/dropbox/session.py&quot;</span> <span class="ow">in</span> <span class="n">obtain_request_token</span>
  <span class="mf">181.</span>         <span class="n">response</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">rest_client</span><span class="o">.</span><span class="n">POST</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="n">params</span><span class="p">,</span> <span class="n">raw_response</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="n">File</span> <span class="s">&quot;/usr/local/lib/python2.7/dist-packages/dropbox/rest.py&quot;</span> <span class="ow">in</span> <span class="n">POST</span>
  <span class="mf">260.</span>         <span class="k">return</span> <span class="n">cls</span><span class="o">.</span><span class="n">IMPL</span><span class="o">.</span><span class="n">POST</span><span class="p">(</span><span class="o">*</span><span class="n">n</span><span class="p">,</span> <span class="o">**</span><span class="n">kw</span><span class="p">)</span>
<span class="n">File</span> <span class="s">&quot;/usr/local/lib/python2.7/dist-packages/dropbox/rest.py&quot;</span> <span class="ow">in</span> <span class="n">POST</span>
  <span class="mf">207.</span>                             <span class="n">post_params</span><span class="o">=</span><span class="n">params</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">,</span> <span class="n">raw_response</span><span class="o">=</span><span class="n">raw_response</span><span class="p">)</span>
<span class="n">File</span> <span class="s">&quot;/usr/local/lib/python2.7/dist-packages/dropbox/rest.py&quot;</span> <span class="ow">in</span> <span class="n">request</span>
  <span class="mf">177.</span>             <span class="k">raise</span> <span class="n">RESTSocketError</span><span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span>

<span class="ne">Exception</span> <span class="n">Type</span><span class="p">:</span> <span class="n">RESTSocketError</span> <span class="n">at</span> <span class="o">/</span><span class="n">Submitted_Code</span><span class="o">/</span>
<span class="ne">Exception</span> <span class="n">Value</span><span class="p">:</span> <span class="n">Error</span> <span class="n">connecting</span> <span class="n">to</span> <span class="s">&quot;api.dropbox.com&quot;</span><span class="p">:</span> <span class="p">[</span><span class="n">Errno</span> <span class="mi">111</span><span class="p">]</span> <span class="n">Connection</span> <span class="n">refused</span>
</pre></div>


<p>Kindly help me in solving the above problem...</p>
<p>Thanks,
San</p>
<p><em>edited by admin for formatting</em></p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5436_creator_details">
                            
                                
                            
                            sansoftaus
                            |
                            17
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5436_created_date">
                            July 18, 2013, 7:31 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5436">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5440" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5440_content_text" class="span8">
                        <p>We only allow outgoing access to a limited number of sites for Free accounts. I'm quite surprised that api.dropbox.com was not in the whitelist already, so I've added it. It may still not work depending on the underlying url library that the dropbox rest client uses, but at least we're not getting in the way anymore.</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5440_creator_details">
                            
                                <img src="/static/anywhere/images/staff.png" alt="Staff" title="Staff"/>
                            
                            glenn
                            |
                            418
                            posts
                            |
                            
                                PythonAnywhere staff
                                |
                            
                        </span>
                        <span id="id_post_5440_created_date">
                            July 19, 2013, 10:43 a.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5440">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5443" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5443_content_text" class="span8">
                        <p>Thanks Glenn, I will give a try now and let you know the status !</p>
<p>San</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5443_creator_details">
                            
                                
                            
                            sansoftaus
                            |
                            17
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5443_created_date">
                            July 19, 2013, 11:11 a.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5443">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5444" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5444_content_text" class="span8">
                        <p>Hi Glen,</p>
<p>I still get the same error,
Also, the whitelist https://www.pythonanywhere.com/whitelist/ is not yet updated with api.dropbox.com</p>
<p>How long it may take to get reflected ?</p>
<p>Thanks,
San</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5444_creator_details">
                            
                                
                            
                            sansoftaus
                            |
                            17
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5444_created_date">
                            July 19, 2013, 11:17 a.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5444">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5448" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5448_content_text" class="span8">
                        <p>It's possible that even after the PA devs have updated the list, it takes a little time to propagate through the system. Hopefully one of them will be able to drop by and give you an indication of how long this is likely to take. If it's not working in 24 hours I would definitely add another comment to this thread.</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5448_creator_details">
                            
                                
                                    <img src="/static/anywhere/images/star.gif" alt="Beloved premium user" title="Beloved premium user"/>
                                
                            
                            Cartroo
                            |
                            638
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5448_created_date">
                            July 19, 2013, 11:51 a.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5448">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5452" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5452_content_text" class="span8">
                        <p>The whitelist on the site always lags the real thing because we only update it when we upgrade PythonAnywhere software.</p>
<p>You're still getting the error because the dropbox library does not honour the environment proxy settings so it's trying to go directly to api.dropbox.com and we block that. This is a fairly common issue with many of the Python REST libraries. You should raise the issue with the library authors.</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5452_creator_details">
                            
                                <img src="/static/anywhere/images/staff.png" alt="Staff" title="Staff"/>
                            
                            glenn
                            |
                            418
                            posts
                            |
                            
                                PythonAnywhere staff
                                |
                            
                        </span>
                        <span id="id_post_5452_created_date">
                            July 19, 2013, 12:04 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5452">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5453" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5453_content_text" class="span8">
                        <p>Thanks Glenn ! I will escalate this issue to Dropbox team.</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5453_creator_details">
                            
                                
                            
                            sansoftaus
                            |
                            17
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5453_created_date">
                            July 19, 2013, 12:08 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5453">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5454" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5454_content_text" class="span8">
                        <p>Also, do you think google drive would work well with pythonanywhere if am not able to use Dropbox ??</p>
<p>Thanks,
San</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5454_creator_details">
                            
                                
                            
                            sansoftaus
                            |
                            17
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5454_created_date">
                            July 19, 2013, 12:12 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5454">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5456" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5456_content_text" class="span8">
                        <p>Well, the Google Drive REST APIs are public so you could always implement your own code which uses them directly if ncessary (although OAuth is a bit fiddly). It's hard to say whether Google's own Python bindings will obey the proxy settings - it's one of those things which is better just to try and see how it works out.</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5456_creator_details">
                            
                                
                                    <img src="/static/anywhere/images/star.gif" alt="Beloved premium user" title="Beloved premium user"/>
                                
                            
                            Cartroo
                            |
                            638
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5456_created_date">
                            July 19, 2013, 12:17 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5456">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5493" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5493_content_text" class="span8">
                        <p>Hi Glen,</p>
<p>Following was the response from Dropbox team:-</p>
<p>It looks like api.dropbox.com still isn't being allowed... try this:</p>
<div class="codehilite"><pre><span class="kn">import</span> <span class="nn">requests</span>
<span class="k">print</span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;https://api.dropbox.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span>
</pre></div>


<p>You'll see an error response from Squid, which appears to be what PythonAnywhere uses to proxy outbound requests.</p>
<p>Thread for this conversation:-
<a href="https://forums.dropbox.com/topic.php?id=103225&amp;replies=11#post-558061">https://forums.dropbox.com/topic.php?id=103225&amp;replies=11#post-558061</a></p>
<p>Thanks,
Santhosh</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5493_creator_details">
                            
                                
                            
                            sansoftaus
                            |
                            17
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5493_created_date">
                            July 21, 2013, 10:39 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5493">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5499" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5499_content_text" class="span8">
                        <p>Hi Santhosh,</p>
<p>Did you actually try doing what the Dropbox support people asked you to?</p>
<p>In any case, I did!  I've added <a href="https://forums.dropbox.com/topic.php?id=103225&amp;replies=14#post-558112">a post</a> on the dropbox forum, here's the conclusion:</p>
<ul>
<li>requests is broken for some types of HTTPS over a proxy.  There is an <a href="https://github.com/kennethreitz/requests/issues/1359">outstanding issue</a></li>
<li><code>curl -v https://api.dropbox.com</code> <strong>does</strong> work, so it's not the proxy's fault</li>
<li>presumably Dropbox is broken in a similar way to requests.</li>
</ul>
<p>So, for now the only solution is to pay up and upgrade!  Go on, it's only $5.  And, we have a 30-day money-back guarantee, so if for whatever reason you're not happy, or you can't get it working even with a paid account, we'll happily refund you...</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5499_creator_details">
                            
                                <img src="/static/anywhere/images/staff.png" alt="Staff" title="Staff"/>
                            
                            harry
                            |
                            376
                            posts
                            |
                            
                                PythonAnywhere staff
                                |
                            
                        </span>
                        <span id="id_post_5499_created_date">
                            July 22, 2013, 11:16 a.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5499">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5525" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5525_content_text" class="span8">
                        <p>Thanks Harry,
I will upgrade my Account and start using Dropbox !! I will post if I face any problems.... </p>
<p>~San</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5525_creator_details">
                            
                                
                            
                            sansoftaus
                            |
                            17
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5525_created_date">
                            July 22, 2013, 8:25 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5525">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5583" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5583_content_text" class="span8">
                        <p>A small query on the pay...
If I register today ie on 24th July for 5Dollar / month plan, will I be able to get the service until 24th August ? </p>
<p>Or do I need to again make a payment on 1st of August, please let me know how it works !</p>
<p>Thanks,
San</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5583_creator_details">
                            
                                
                                    <img src="/static/anywhere/images/star.gif" alt="Beloved premium user" title="Beloved premium user"/>
                                
                            
                            ulmastersproject
                            |
                            28
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5583_created_date">
                            July 24, 2013, 2:28 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5583">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5585" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5585_content_text" class="span8">
                        <p>If you pay today you get until 24 August.</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5585_creator_details">
                            
                                <img src="/static/anywhere/images/staff.png" alt="Staff" title="Staff"/>
                            
                            giles
                            |
                            866
                            posts
                            |
                            
                                PythonAnywhere staff
                                |
                            
                        </span>
                        <span id="id_post_5585_created_date">
                            July 24, 2013, 2:46 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5585">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5589" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5589_content_text" class="span8">
                        <p>Hi I upgraded my account by paying 6 Dollars / month  (VAT = 1 Dollar) But am still not able to use api.dropbox.com</p>
<p>Following is the error :-</p>
<p>Environment:</p>
<p>Request Method: GET
Request URL: http://ulmastersproject.pythonanywhere.com/Submitted_Code/</p>
<p>Django Version: 1.3.7
Python Version: 2.7.4
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')</p>
<p>Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, <strong>callback_kwargs)
File "/home/ulmastersproject/Remote_Software_Development/Development/views.py" in Submitted_code
  38.     dropbox_request_token = dropbox_sess.obtain_request_token()
File "/usr/local/lib/python2.7/dist-packages/dropbox/session.py" in obtain_request_token
  181.         response = self.rest_client.POST(url, headers=headers, params=params, raw_response=True)
File "/usr/local/lib/python2.7/dist-packages/dropbox/rest.py" in POST
  260.         return cls.IMPL.POST(*n, </strong>kw)
File "/usr/local/lib/python2.7/dist-packages/dropbox/rest.py" in POST
  207.                             post_params=params, headers=headers, raw_response=raw_response)
File "/usr/local/lib/python2.7/dist-packages/dropbox/rest.py" in request
  177.             raise RESTSocketError(host, e)</p>
<p>Exception Type: RESTSocketError at /Submitted_Code/
Exception Value: Error connecting to "api.dropbox.com": [Errno 111] Connection refused</p>
<p>Please help me....</p>
<p>URL: http://ulmastersproject.pythonanywhere.com/Submitted_Code/</p>
<p>Thanks,
San</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5589_creator_details">
                            
                                
                                    <img src="/static/anywhere/images/star.gif" alt="Beloved premium user" title="Beloved premium user"/>
                                
                            
                            ulmastersproject
                            |
                            28
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5589_created_date">
                            July 24, 2013, 3:45 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5589">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5592" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5592_content_text" class="span8">
                        <p>Have you tried reloading your web app? It may be required to get the upgraded environment to take effect.</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5592_creator_details">
                            
                                
                                    <img src="/static/anywhere/images/star.gif" alt="Beloved premium user" title="Beloved premium user"/>
                                
                            
                            Cartroo
                            |
                            638
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5592_created_date">
                            July 24, 2013, 4:03 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5592">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5593" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5593_content_text" class="span8">
                        <p>Oh yes, after reloading it is working fine !! Am happy now :) 
Wow Integrated DropBox !!</p>
<p>Thanks Cartroo </p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5593_creator_details">
                            
                                
                                    <img src="/static/anywhere/images/star.gif" alt="Beloved premium user" title="Beloved premium user"/>
                                
                            
                            ulmastersproject
                            |
                            28
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5593_created_date">
                            July 24, 2013, 4:33 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5593">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5594" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5594_content_text" class="span8">
                        <p>Hmm, perhaps we need to make that clearer -- after upgrading, it's only new processes that pick up the upgrade.  Thanks for helping out, Cartroo :-)</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5594_creator_details">
                            
                                <img src="/static/anywhere/images/staff.png" alt="Staff" title="Staff"/>
                            
                            giles
                            |
                            866
                            posts
                            |
                            
                                PythonAnywhere staff
                                |
                            
                        </span>
                        <span id="id_post_5594_created_date">
                            July 24, 2013, 5:09 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5594">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5599" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5599_content_text" class="span8">
                        <p>Hi,</p>
<p>I find a strange behavior with Dropbox Authentication...
After receiving the dropbox request token, am trying to upload a tar file through the following API:-
dropbox_client.put_file()</p>
<p>Following is the Error I receive:-
Environment:</p>
<p>Request Method: GET
Request URL: http://ulmastersproject.pythonanywhere.com/Submitted_Code/Add_to_dropbox/</p>
<p>Django Version: 1.3.7
Python Version: 2.7.4
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')</p>
<p>Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, <strong>callback_kwargs)
File "/home/ulmastersproject/Remote_Software_Development/Development/views.py" in Add_to_dropbox
  83.     response = dropbox_client.put_file('/Remote_Software.tar', f, overwrite=True)
File "/usr/local/lib/python2.7/dist-packages/dropbox/client.py" in put_file
  354.         return self.rest_client.PUT(url, file_obj, headers)
File "/usr/local/lib/python2.7/dist-packages/dropbox/rest.py" in PUT
  265.         return cls.IMPL.PUT(*n, </strong>kw)
File "/usr/local/lib/python2.7/dist-packages/dropbox/rest.py" in PUT
  211.         return self.request("PUT", url, body=body, headers=headers, raw_response=raw_response)
File "/usr/local/lib/python2.7/dist-packages/dropbox/rest.py" in request
  183.             raise ErrorResponse(r)</p>
<p>Exception Type: ErrorResponse at /Submitted_Code/Add_to_dropbox/
Exception Value: [401] u'Authentication failed'</p>
<p>I do not get such errors on my local system, but through Pythonanywhere I get this Error, Do u think still there is some problem with Dropbox Rest API's or Pythonanywhere is blocking something ??</p>
<p>Pls help me out... </p>
<p>Thanks,
San</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5599_creator_details">
                            
                                
                                    <img src="/static/anywhere/images/star.gif" alt="Beloved premium user" title="Beloved premium user"/>
                                
                            
                            ulmastersproject
                            |
                            28
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5599_created_date">
                            July 24, 2013, 6:09 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5599">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5600" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5600_content_text" class="span8">
                        <p>Also, following is a strange behavior, I get the same error even after I have a paid account from pythonanywhere:-</p>
<p>On bash shell:-</p>
<blockquote>
<blockquote>
<blockquote>
<p>from dropbox import client, rest, session                                                                                                                        <br />
APP_KEY = &lt;hidden&gt;                                                                                                                                      <br />
APP_SECRET = &lt;hidden&gt;                                                                                                                                   <br />
ACCESS_TYPE = 'app_folder'                                                                                                                                       <br />
sess = session.DropboxSession(APP_KEY, APP_SECRET, ACCESS_TYPE)                                                                                                  <br />
request_token = sess.obtain_request_token()                                                                                                                      <br />
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/usr/local/lib/python2.7/dist-packages/dropbox/session.py", line 181, in obtain_request_token
    response = self.rest_client.POST(url, headers=headers, params=params, raw_response=True)
  File "/usr/local/lib/python2.7/dist-packages/dropbox/rest.py", line 260, in POST
    return cls.IMPL.POST(<em>n, </em>*kw)
  File "/usr/local/lib/python2.7/dist-packages/dropbox/rest.py", line 207, in POST
    post_params=params, headers=headers, raw_response=raw_response)
  File "/usr/local/lib/python2.7/dist-packages/dropbox/rest.py", line 177, in request
    raise RESTSocketError(host, e)
dropbox.rest.RESTSocketError: Error connecting to "api.dropbox.com": [Errno 111] Connection refused</p>
</blockquote>
</blockquote>
</blockquote>
<p>The above commands on my local system works very well...
Pls help me, I guess there is still some block from pythonanywhere to Dropbox (with Paid account)</p>
<p>Thanks,
San</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5600_creator_details">
                            
                                
                                    <img src="/static/anywhere/images/star.gif" alt="Beloved premium user" title="Beloved premium user"/>
                                
                            
                            ulmastersproject
                            |
                            28
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5600_created_date">
                            July 24, 2013, 6:58 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5600">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5601" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5601_content_text" class="span8">
                        <p>Pls help me, make me pass my University degree... This project decides my future ! I have paid as per your suggestion...
Kindly help me out...</p>
<p>Thanks,
San</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5601_creator_details">
                            
                                
                                    <img src="/static/anywhere/images/star.gif" alt="Beloved premium user" title="Beloved premium user"/>
                                
                            
                            ulmastersproject
                            |
                            28
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5601_created_date">
                            July 24, 2013, 7:23 p.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5601">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5620" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5620_content_text" class="span8">
                        <p>We're not blocking anything. When you upgraded, we removed any filtering between the internet and your account. I see that you only have one console and the it was created before you upgraded. You need to start a new console to have the new paying settings applied to it.</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5620_creator_details">
                            
                                <img src="/static/anywhere/images/staff.png" alt="Staff" title="Staff"/>
                            
                            glenn
                            |
                            418
                            posts
                            |
                            
                                PythonAnywhere staff
                                |
                            
                        </span>
                        <span id="id_post_5620_created_date">
                            July 25, 2013, 10:41 a.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5620">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5621" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5621_content_text" class="span8">
                        <p><em>EDIT: I started drafting this response before @Glenn's appeared, but I'll leave it intact despite the slight overlap.</em></p>
<p>Was that a newly-created bash shell? It wasn't one that you started before your account was upgraded was it? If so, you'll need to close it (easiest is to hit CTRL-D at the bash prompt) and then open a new one - this is for the same reason that your web app needed reloading.</p>
<p>The earlier problem with a 401 error looks different. I'm not familiar with the Dropbox API but <a href="https://www.dropbox.com/developers/core/docs">this page</a> seems to state that it means:</p>
<blockquote>
<p>Bad or expired token. This can happen if the user or Dropbox revoked or expired an access token. To fix, you should re-authenticate the user.</p>
</blockquote>
<p>Sounds to me like perhaps there's a bug in your OAuth code? For reference I've successfully authenticated like this:</p>
<div class="codehilite"><pre><span class="n">session</span> <span class="o">=</span> <span class="n">dropbox</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">DropboxSession</span><span class="p">(</span><span class="n">APP_KEY</span><span class="p">,</span> <span class="n">APP_SECRET</span><span class="p">,</span> <span class="s">&quot;dropbox&quot;</span><span class="p">)</span>
<span class="n">request_token</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="n">obtain_request_token</span><span class="p">()</span>
<span class="n">auth_url</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="n">build_authorize_url</span><span class="p">(</span><span class="n">request_token</span><span class="p">)</span>
<span class="k">print</span> <span class="s">&quot;Visit &quot;</span> <span class="o">+</span> <span class="n">auth_url</span> <span class="o">+</span> <span class="s">&quot; and authorize app&quot;</span>
<span class="nb">raw_input</span><span class="p">(</span><span class="s">&quot;Press ENTER when authorized&quot;</span><span class="p">)</span>
<span class="n">access_token</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="n">obtain_access_token</span><span class="p">()</span>

<span class="k">print</span> <span class="s">&quot;Access key: &quot;</span> <span class="o">+</span> <span class="n">access_token</span><span class="o">.</span><span class="n">key</span>
<span class="k">print</span> <span class="s">&quot;Access secret: &quot;</span> <span class="o">+</span> <span class="n">access_token</span><span class="o">.</span><span class="n">secret</span>
</pre></div>


<p>You then need to note down the <strong>key</strong> and <strong>secret</strong> in a file or database somewhere. You only need to do this once when the user first authorizes your app to your Dropbox account. After this point, assuming you've got the key and secret from earlier stored in <code>ACCESS_KEY</code> and <code>ACCESS_SECRET</code> then you can simply do something like this:</p>
<div class="codehilite"><pre><span class="n">session</span> <span class="o">=</span> <span class="n">dropbox</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">DropboxSession</span><span class="p">(</span><span class="n">APP_KEY</span><span class="p">,</span> <span class="n">APP_SECRET</span><span class="p">,</span> <span class="s">&quot;dropbox&quot;</span><span class="p">)</span>
<span class="n">session</span><span class="o">.</span><span class="n">set_token</span><span class="p">(</span><span class="n">ACCESS_KEY</span><span class="p">,</span> <span class="n">ACCESS_SECRET</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">dropbox</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">DropboxClient</span><span class="p">(</span><span class="n">session</span><span class="p">)</span>
<span class="n">account_info</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">account_info</span><span class="p">()</span>
<span class="k">print</span> <span class="s">&quot;Hello, &quot;</span> <span class="o">+</span> <span class="n">account_info</span><span class="p">[</span><span class="s">&quot;display_name&quot;</span><span class="p">]</span>
</pre></div>


<p>This code is, of course, just an example. But I've just retried it and it definitely works, so hopefully you can start from here.</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5621_creator_details">
                            
                                
                                    <img src="/static/anywhere/images/star.gif" alt="Beloved premium user" title="Beloved premium user"/>
                                
                            
                            Cartroo
                            |
                            638
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5621_created_date">
                            July 25, 2013, 11:20 a.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5621">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5623" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5623_content_text" class="span8">
                        <p>Hi Glen, </p>
<p>Thanks, I was worried too much due to my project deadline... Yes, its working absolutely fine !  I love Pythonanywhere !!</p>
<p>Thanks again,
San</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5623_creator_details">
                            
                                
                                    <img src="/static/anywhere/images/star.gif" alt="Beloved premium user" title="Beloved premium user"/>
                                
                            
                            ulmastersproject
                            |
                            28
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5623_created_date">
                            July 25, 2013, 11:51 a.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5623">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    
        <div class="row">
            <div id="id_post_5624" class="span8 offset3 post">
                <div class="row">
                    <div id="id_post_5624_content_text" class="span8">
                        <p>Hi Cartroo,</p>
<p>Yes, that was a token error which I had messed up in my code, thanks again for your explanation.</p>
<p>~San</p>
                    </div>
                </div>
                <div class="row">
                    <div class="span7 post_metadata">
                        <span id="id_post_5624_creator_details">
                            
                                
                                    <img src="/static/anywhere/images/star.gif" alt="Beloved premium user" title="Beloved premium user"/>
                                
                            
                            ulmastersproject
                            |
                            28
                            posts
                            |
                            
                        </span>
                        <span id="id_post_5624_created_date">
                            July 25, 2013, 11:53 a.m.
                        </span>
                        |
                        <a href="https://www.pythonanywhere.com/forums/topic/761/#id_post_5624">permalink</a>
                    </div>
                    <div class="span1">
                        
                    </div>
                </div>
            </div>
        </div>
    

    




        <div id="id_footer" class="container">

            <footer id="id_copyright_div">
                <p>
                    Copyright &copy; 2013 PythonAnywhere LLP
                    &mdash;
                    <a href="/terms/">Terms</a>
                    &mdash;
                    <a href="/privacy/">Privacy</a><br/>
                    "Python" is a registered trademark of the Python Software Foundation.
                </p>
            </footer>

        </div>

        
        

        <div id="id_feedback_dialog" title="Help us improve" style="display:none">
    <div id="id_feedback_dialog_blurb_big" class="dialog_blurb_big">
        It's always a pleasure to hear from you!
    </div>
    <div id="id_feedback_dialog_blurb_small">
        Ask us a question, or tell us what you love or hate about PythonAnywhere.<br/>
        We'll get back to you over email ASAP.
    </div>
    <textarea id="id_feedback_dialog_text" rows="6"></textarea>
    <input id="id_feedback_dialog_email_address" type="text" class="default_prompt"/>
    <div id="id_feedback_dialog_error" class="pa_hidden">
        Sorry, there was an error connecting to the server. <br/>Please try again in a few moments...
    </div>
    <div class="dialog_buttons">
        <img id="id_feedback_dialog_spinner" src="/static/anywhere/images/spinner-small.gif" />
        <button class="btn btn-primary" id="id_feedback_dialog_ok_button">OK</button>
        <button class="btn" id="id_feedback_dialog_cancel_button">Cancel</button>
    </div>
</div>


        <!-- Le javascript
        ================================================== -->
        <!-- Placed at the end of the document so the pages load faster -->
        <script type="text/javascript" src="/static/jquery/jquery-1.7.1.min.js"></script>
        <script type="text/javascript" src="/static/jquery/jquery-ui-1.8.11.custom.min.js"></script>
        <script src="/static/bootstrap/js/bootstrap-transition.js"></script>
        <script src="/static/bootstrap/js/bootstrap-alert.js"></script>
        <script src="/static/bootstrap/js/bootstrap-modal.js"></script>
        <script src="/static/bootstrap/js/bootstrap-dropdown.js"></script>
        <script src="/static/bootstrap/js/bootstrap-scrollspy.js"></script>
        <script src="/static/bootstrap/js/bootstrap-tab.js"></script>
        <script src="/static/bootstrap/js/bootstrap-tooltip.js"></script>
        <script src="/static/bootstrap/js/bootstrap-popover.js"></script>
        <script src="/static/bootstrap/js/bootstrap-button.js"></script>
        <script src="/static/bootstrap/js/bootstrap-collapse.js"></script>
        <script src="/static/bootstrap/js/bootstrap-carousel.js"></script>
        <script src="/static/bootstrap/js/bootstrap-typeahead.js"></script>

        <script type="text/javascript">
            var urls = {};
            var Anywhere = {};
            Anywhere.urls = {};
        </script>
        <script type="text/javascript" src="/static/anywhere/scripts/ajax_utils.js"></script>

        <script type="text/javascript" src="/static/anywhere/scripts/feedback_dialog.js"></script>
        
        <script type="text/javascript">
            $(function() {
                $.extend(
                    urls,
                    {
                        feedback: '/feedback/submit/'
                    }
                );
                
                    Anywhere.FeedbackDialog.Initialise(urls, false);
                
            });
        </script>

        <script type="text/javascript">

            var _gaq = _gaq || [];
            _gaq.push(['_setAccount', 'UA-18014859-6']);
            _gaq.push(['_trackPageview']);

            (function() {
                var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
            })();

        </script>

        



    </body>
</html>
